package com.atguigu.srb.base.exception;

import com.atguigu.srb.base.result.ResponseEnum;

public class Assert {
    //判断对象是否为空
    //如果对象为空 抛出自定义类型的异常
    public static void assertObjIsNull(Object obj, ResponseEnum responseEnum){
        if(obj==null){
            throw new SrbBussinessException(responseEnum);
        }
    }
    //判断 如果传入的布尔值不是true抛出异常
    public static void assertNotTrue(Boolean flag, ResponseEnum responseEnum){
        if(!flag){
            throw new SrbBussinessException(responseEnum);
        }
    }

    public static void assertTrue(boolean b, ResponseEnum responseEnum) {
        if(b){
            throw new SrbBussinessException(responseEnum);
        }
    }
}
